package com.dubbo.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.alibaba.dubbo.config.annotation.Service;
import com.dubbo.entity.Admin;
import com.dubbo.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

/**
 * 客户端测试
 *
 * @author zhang he qiang
 */
@Controller
@RequestMapping("/test")
public class TestController {

    /****************************************************** Query *****************************************************/
    @Reference(interfaceName = "com.dubbo.service.AdminService", version = "1.0.0", check = false)
    private AdminService service;

    @RequestMapping(value = "/findAll")
    public String findAll(Model model) {
        List<Admin> list = service.selectAll();
        model.addAttribute("list", list);
        return "admin/list";
    }

}
